package com.jhd.jiangxi.util;

import android.text.Editable;
import android.text.method.KeyListener;
import android.view.KeyEvent;
import android.view.View;
import android.widget.EditText;

import com.jhd.jiangxi.entity.LastInputEditText;

public class EditTextDel {
    public static void setCanDel(LastInputEditText editText, boolean canOrNot){
            if(canOrNot){
                editText.setFocusableInTouchMode(true);
                editText.requestFocus();
                editText.setClearIconVisible(false);
            }else{
                editText.setFocusableInTouchMode(false);
                editText.clearFocus();
                editText.setClearIconVisible(true);
            }
        /*if(canOrNot){
            editText.setKeyListener(new KeyListener() {
                @Override
                public int getInputType() {
                    return 0;
                }

                @Override
                public boolean onKeyDown(View view, Editable text, int keyCode, KeyEvent event) {
                    return false;
                }

                @Override
                public boolean onKeyUp(View view, Editable text, int keyCode, KeyEvent event) {
                    return false;
                }

                @Override
                public boolean onKeyOther(View view, Editable text, KeyEvent event) {
                    return false;
                }

                @Override
                public void clearMetaKeyState(View view, Editable content, int states) {

                }
            });
        }else{
            editText.setKeyListener(null);
        }*/
    }
}
